import { RouteConfig } from 'vue-router'
import { UserModule } from '@/store/modules/user'

export const userRouter: RouteConfig[] = [
  {
    name: 'UserDefault',
    path: '/user',
    redirect: () => UserModule.id === '' ? { name: 'Login' } : { name: 'User', params: { userId: UserModule.id } }
  },
  {
    name: 'User',
    path: '/user/:userId',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/index.vue'),
    meta: {
      title: '用户',
      icon: 'md-person'
    }
  }
]
